In a low-level language like C, we can use pointers to create a circular data structure directly.
The same pointer manipulation can be done more safely in a higher level language like Lisp via (rplacd ...) or (setf (cdr ...) ..).
In any language, we can use arrays and modular arithmetic.
Best solution: use an existing, debugged circular data structure module!